load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("scm_client_infra")

cpp_library(
    name = "test_mount",
    srcs = [
        "TestMount.cpp",
    ],
    headers = [
        "TestMount.h",
    ],
    deps = [
        "fbsource//third-party/googletest:gtest",
        ":fake_backing_store_and_tree_builder",
        ":fake_fuse",
        ":fake_inode_access_logger",
        ":fake_privhelper",
        ":test_config_source",
        ":test_util",
        "//eden/common/telemetry:structured_logger",
        "//eden/common/testharness:temp_file",
        "//eden/common/utils:file_utils",
        "//eden/common/utils:process_info_cache",
        "//eden/common/utils:user_info",
        "//eden/common/utils:utils",
        "//eden/fs/config:config",
        "//eden/fs/journal:journal",
        "//eden/fs/notifications:command_notifier",
        "//eden/fs/service:pretty_printers",
        "//eden/fs/store:backing_store_interface",
        "//eden/fs/store:store",
        "//eden/fs/telemetry:scribe_logger",
        "//eden/fs/telemetry:stats",
        "//eden/fs/utils:eden_error",
        "//folly:file_util",
        "//folly/io:iobuf",
        "//folly/logging:logging",
        "//folly/testing:test_util",
    ],
    exported_deps = [
        ":fake_clock",
        "//eden/common/utils:case_sensitivity",
        "//eden/common/utils:path",
        "//eden/fs/fuse:fuse",
        "//eden/fs/inodes:inode_number",
        "//eden/fs/inodes:inodes",
        "//eden/fs/inodes/overlay:serialization-cpp2-types",
        "//eden/fs/model:model",
        "//folly:portability",
        "//folly:range",
        "//folly/executors:manual_executor",
    ],
    external_deps = [
        "gflags",
    ],
)

cpp_library(
    name = "test_util",
    srcs = ["TestUtil.cpp"],
    headers = ["TestUtil.h"],
    deps = [
        "//eden/fs/model:model",
    ],
    exported_deps = [
        "//eden/fs/inodes:inode_number",
        "//eden/fs/inodes:inodes",
        "//eden/fs/service:thrift-cpp2-types",
        "//folly:range",
        "//folly/concurrency:unbounded_queue",
    ],
)

cpp_library(
    name = "test_config_source",
    srcs = ["TestConfigSource.cpp"],
    headers = ["TestConfigSource.h"],
    deps = [
        "//folly:map_util",
    ],
    exported_deps = [
        "//eden/fs/config:config",
        "//folly:synchronized",
    ],
)

cpp_library(
    name = "fake_clock",
    headers = ["FakeClock.h"],
    exported_deps = [
        "//eden/fs/utils:clock",
        "//folly/chrono:conv",
    ],
)

cpp_library(
    name = "test_checks",
    headers = ["TestChecks.h"],
    exported_deps = [
        "fbsource//third-party/fmt:fmt",
        "fbsource//third-party/googletest:gtest",
        "//eden/fs/inodes:inodes",
        "//eden/fs/store:context",
        "//folly:range",
        "//folly/io:iobuf",
    ],
)

cpp_library(
    name = "fake_fuse",
    srcs = ["FakeFuse.cpp"],
    headers = ["FakeFuse.h"],
    deps = [
        "//folly:exception",
        "//folly:file_util",
        "//folly/chrono:conv",
        "//folly/logging:logging",
        "//folly/portability:sockets",
    ],
    exported_deps = [
        "//eden/fs/utils:fs_channel_types",
        "//folly:file",
        "//folly:range",
    ],
)

cpp_library(
    name = "test_dispatcher",
    srcs = ["TestDispatcher.cpp"],
    headers = ["TestDispatcher.h"],
    deps = [
        "//folly:conv",
        "//folly/logging:logging",
    ],
    exported_deps = [
        "//eden/common/utils:path",
        "//eden/fs/fuse:fuse",
        "//eden/fs/store:store",
        "//folly:synchronized",
        "//folly/futures:core",
    ],
)

cpp_library(
    name = "fake_privhelper",
    srcs = ["FakePrivHelper.cpp"],
    headers = ["FakePrivHelper.h"],
    deps = [
        ":fake_fuse",
        "//eden/fs/utils:eden_error",
        "//folly:file",
    ],
    exported_deps = [
        "//eden/common/utils:path",
        "//eden/fs/privhelper:interface",
        "//folly/futures:core",
    ],
)

cpp_library(
    name = "logging_fetch_context",
    headers = ["LoggingFetchContext.h"],
    exported_deps = [
        "//eden/fs/store:store",
    ],
)

cpp_library(
    name = "stored_object",
    headers = ["StoredObject.h"],
    exported_deps = [
        "//eden/common/utils:immediate_future",
    ],
)

cpp_library(
    name = "fake_backing_store_and_tree_builder",
    srcs = [
        "FakeBackingStore.cpp",
        "FakeTreeBuilder.cpp",
    ],
    headers = [
        "FakeBackingStore.h",
        "FakeTreeBuilder.h",
    ],
    deps = [
        "fbsource//third-party/fmt:fmt",
        ":test_util",
        "//eden/common/utils:enum",
        "//eden/common/utils:fault_injector",
        "//eden/fs/inodes:inodes",
        "//folly:map_util",
        "//folly/futures:core",
        "//folly/logging:logging",
        "//folly/ssl:openssl_hash",
    ],
    exported_deps = [
        "fbsource//third-party/googletest:gtest",
        ":stored_object",
        "//eden/common/utils:path",
        "//eden/common/utils:utils",
        "//eden/fs/model:model",
        "//eden/fs/store:backing_store_interface",
        "//eden/fs/store:context",
        "//folly:exception_wrapper",
        "//folly:range",
        "//folly/coro:task",
    ],
)

cpp_library(
    name = "fake_object_store",
    srcs = ["FakeObjectStore.cpp"],
    headers = ["FakeObjectStore.h"],
    deps = [
        "//eden/common/utils:immediate_future",
        "//folly:map_util",
        "//folly/futures:core",
    ],
    exported_deps = [
        "//eden/fs/model:model",
        "//eden/fs/store:context",
        "//eden/fs/store:store",
    ],
)

cpp_library(
    name = "fake_filter",
    headers = ["FakeFilter.h"],
    exported_deps = [
        "//eden/fs/store/filter:filters",
    ],
)

cpp_library(
    name = "hg_repo",
    srcs = [
        "HgBinary.cpp",
        "HgRepo.cpp",
    ],
    headers = [
        "HgBinary.h",
        "HgRepo.h",
    ],
    deps = [
        "//eden/common/utils:file_utils",
        "//folly:exception",
        "//folly:file",
        "//folly:file_util",
        "//folly:portability",
        "//folly:range",
        "//folly:string",
        "//folly/logging:logging",
        "//folly/portability:unistd",
        "//folly/portability:windows",
    ],
    exported_deps = [
        "//eden/common/utils:path",
        "//eden/common/utils:process",
        "//eden/fs/model:model",
    ],
    exported_external_deps = [
        "gflags",
    ],
)

cpp_library(
    name = "test_server",
    srcs = ["TestServer.cpp"],
    headers = ["TestServer.h"],
    deps = [
        ":fake_privhelper",
        "//eden/common/telemetry:log_info",
        "//eden/common/testharness:temp_file",
        "//eden/common/utils:user_info",
        "//eden/fs/config:config",
        "//eden/fs/service:server",
        "//eden/fs/service:startup_logger",
        "//eden/fs/store:backing_store_interface",
        "//eden/fs/telemetry:activity_recorder",
        "//eden/fs/telemetry:scribe_logger",
    ],
    exported_deps = [
        "//eden/common/utils:path",
        "//eden/fs/service:startup_status_subscriber",
        "//folly/testing:test_util",
    ],
    external_deps = [
        "gflags",
    ],
)

cpp_library(
    name = "inode_unloader",
    headers = ["InodeUnloader.h"],
    exported_deps = [
        "fbsource//third-party/googletest:gtest",
        "//eden/fs/inodes:inodes",
    ],
)

cpp_library(
    name = "test_server_state",
    srcs = ["TestServerState.cpp"],
    headers = ["TestServerState.h"],
    deps = [
        ":fake_clock",
        ":fake_privhelper",
        "//eden/common/telemetry:structured_logger",
        "//eden/common/utils:process_info_cache",
        "//eden/common/utils:user_info",
        "//eden/common/utils:utils",
        "//eden/fs/config:config",
        "//eden/fs/inodes:inodes",
        "//eden/fs/notifications:command_notifier",
        "//eden/fs/telemetry:scribe_logger",
        "//eden/fs/telemetry:stats",
        "//folly/executors:manual_executor",
    ],
)

cpp_library(
    name = "fake_inode_access_logger",
    headers = ["FakeInodeAccessLogger.h"],
    exported_deps = [
        "//eden/fs/inodes:inodes",
    ],
)
